
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/global.css'); ?>" rel="stylesheet" type="text/css" />
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
    document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<style>

</style>
<?php 
if(isset($_GET["id"])){
	$urlarr=$_GET["id"];
	$maxprice=0;
	$p=1;
	$limit=8; 
	if(isset($_GET['p'])){$p=$_GET['p'];}
	if(isset($_GET['limit'])){$limit=$_GET['limit'];}
	$rowdata=Mage::getModel('marketplaceprofile/marketplaceprofile')->getPartnerProfileById($_GET["id"]);
	if(count($rowdata)<10){$this->_redirect($this->getBaseUrl());}
	if(strlen($rowdata['bannerpic'])>0){$nopic=$rowdata['bannerpic'];}
	else {$nopic='noimage.png';}	
?>
<style>
.main{background-image:none;background-color:<?php echo $rowdata['backgroundth'];?>}
</style>
<div class="compnamecol">
	<div class="compnamecolhead">
		<h1><?php echo Mage::helper('marketplacepartner')->__('View Collection') ?> : </h1><p class="name"><?php echo $rowdata['compname']; ?></p>
	</div>
	<div class="compnamecollink">
		<a href="<?php echo  Mage::getUrl()."marketplacepartner/store?id=".$_GET["id"] ?> " title="<?php echo Mage::helper('marketplacepartner')->__('Visit Store')?>" id="storeconnect"><?php echo Mage::helper('marketplacepartner')->__('View Store')?></a>
		<a href="<?php echo  Mage::getUrl()."marketplacepartner/collection?id=".$_GET["id"] ?>" title="<?php echo Mage::helper('marketplacepartner')->__('Visit Complete Collection')?>" id="siteconnect"><?php echo Mage::helper('marketplacepartner')->__('View Collection')?></a>
		<span class="profile-view">
		<a href="<?php echo  Mage::getUrl()."marketplacepartner/profile?id=".$_GET["id"] ?>" title="<?php echo Mage::helper('marketplacepartner')->__('Visit Profile')?>" id="profileconnect"><?php echo Mage::helper('marketplacepartner')->__('View Profile')?></a>
		<span class="collection-hover-div">
			<?php echo $rowdata['compdesi']; ?>
		</span>
		</span>
	</div>
</div>

<?php
	$a=0;$b=0;$c=0;$d=0;$e=0;$start=0;
	if($p==1){$firstlimit=(($p-1)*$limit);}
	else {$firstlimit=(($p-1)*$limit)+1;}
	$lastlimit=$p*$limit;
	$write = Mage::getSingleton('core/resource')->getConnection('core_write');
	
	$limit=9;
	if(isset($_GET['limit'])){

		$limit=$_GET['limit'];
	}
	$rowdata=Mage::getModel('marketplacepartner/marketplacepartner')->getPartnerProducts($_GET["id"],$limit,$p);
	$j=0;$k=0;$h=0;
	$proid=array();
	foreach($rowdata as $key){
		$totalprocollection[$j]=Mage::getModel('catalog/product')->load($key['mageproductid']);
	
		if((!isset($_GET["priceto"])) && (!isset($_GET["pricefrom"])) &&(isset($_GET["search"]))){
			$priceto=$_GET["priceto"];$pricefrom=$_GET["pricefrom"];
			$totalseachcollection[$j]=Mage::getModel('catalog/product')->load($key['mageproductid']);
			$fivePos = stripos($totalseachcollection[$j]->getMetaKeyword(),$_GET["search"]);
			if($fivePos === false) {}
			else{
					echo 'search product array';
					$totalseachcollection1[$h]=Mage::getModel('catalog/product')->load($key['mageproductid']);
					$h++;
			}	
		}	
		$totalfilterprocollection[$j]=Mage::getModel('catalog/product')->load($key['mageproductid']);
		$j++;				
	}
   
     $pricefrom =$maxprice;
	 $priceto=0;
  
	$_productCollection=$totalprocollection;
?>
	<div class="category-products">
		<div id="paging_container7" >
			<?php 
			echo $this->getToolbarHtml();
			 ?>
			
			<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

			<?php $_columnCount = 4;  // here the number input from the default grid 3 may be we see 3 product in line?>
			<?php $i=0; foreach ($_productCollection as $_product): ?>

        <?php if($_product->getStatus() != 1) continue; if (($i++%$_columnCount==0)): ?>
        <ul class="products-grid content">
        <?php endif ?>
		<li  class="proitem item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
			<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
				<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
			</a>
			<h2 class="product-name">
				<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_product->getName(); ?></a>
			</h2>
			<?php if($_product->getRatingSummary()): ?>
				<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
			<?php endif; ?>
			<span class='regular-price price price-box'>
				<b><?php echo Mage::app()->getStore()-> getCurrentCurrencyCode().''.sprintf('%0.2f',$_product->getPrice()); ?></b>
			</span>
			<div class="actions">
			<?php if($_product->isSaleable()): ?>
					<button type="button" title="<?php echo  Mage::helper('marketplacepartner')->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add',array('product'=>$_product->getId(),'qty'=>1)) ?>')"><span><span><?php echo Mage::helper('marketplacepartner')->__('Add to Cart') ?></span></span></button>
			<?php else: ?>
					<p class="availability out-of-stock"><span><?php echo Mage::helper('marketplacepartner')->__('Out of stock') ?></span></p>
			<?php endif; ?>
				<ul class="add-to-links">
				<?php if ($this->helper('wishlist')->isAllow()) : ?>
					<li>
						<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo Mage::helper('marketplacepartner')->__('Add to Wishlist') ?></a>
					</li>
				<?php endif; ?>
					<li>
						<span class="separator">|</span> 
						<a href="<?php echo $this->helper('catalog/product_compare')->getAddUrl($_product); ?>" class="link-compare"><?php echo Mage::helper('marketplacepartner')->__('Add to Compare') ?></a>
					</li>
				</ul>
			</div>
		</li>
        <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
		</ul>
		<?php endif ?>
		<?php endforeach ?> 
	</ul>
	<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
</div>
</div>	
<script>	
 
$wk_jq=jQuery.noConflict();
$wk_jq('.collection-hover-div')
		.prepend($wk_jq('<a />')
			.attr('href','<?php echo $this->getUrl()."customerpartner/profile?id=".$_GET["id"] ?>')
			.append($wk_jq('<img />')
						.addClass('hover-bannerpicrs')
						.attr('src','<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'avatar/'.$nopic; ?>')
					)
		);
</script>
<?php } ?>